return;
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt))
+ err = xenbus_transaction_start(&xbt);
+ if (err)
return;
str = (char *)xenbus_read(xbt, "control", "shutdown", NULL);
/* Ignore read errors and empty reads. */
int err;
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt))
+ err = xenbus_transaction_start(&xbt);
+ if (err)
return;
if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
printk(KERN_ERR "Unable to read sysrq code in "
/* Supply the information about the device the frontend needs */
again:
- xbt = xenbus_transaction_start();
+ err = xenbus_transaction_start(&xbt);
- if (IS_ERR(xbt)) {
- err = PTR_ERR(xbt);
+ if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
return;
}
goto out;
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt)) {
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_blkring;
}
goto out;
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt)) {
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_ring;
}
unsigned long ready = 1;
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt)) {
- err = PTR_ERR(xbt);
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
xenbus_dev_fatal(be->dev, err, "starting transaction");
return;
}
}
again:
- xbt = xenbus_transaction_start();
- if (IS_ERR(xbt)) {
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_tpmring;
}
}
if (u->u.msg.type == XS_TRANSACTION_START) {
- trans->handle = (xenbus_transaction_t)
- simple_strtoul(reply, NULL, 0);
+ trans->handle = simple_strtoul(reply, NULL, 0);
list_add(&trans->list, &u->transactions);
} else if (u->u.msg.type == XS_TRANSACTION_END) {
list_for_each_entry(trans, &u->transactions, list)
- if ((unsigned long)trans->handle ==
- (unsigned long)u->u.msg.tx_id)
+ if (trans->handle == u->u.msg.tx_id)
break;
BUG_ON(&trans->list == &u->transactions);
list_del(&trans->list);
unsigned int i;
int err;
- msg.tx_id = (u32)(unsigned long)t;
+ msg.tx_id = t;
msg.req_id = 0;
msg.type = type;
msg.len = 0;
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
*/
-xenbus_transaction_t xenbus_transaction_start(void)
+int xenbus_transaction_start(xenbus_transaction_t *t)
{
char *id_str;
- unsigned long id;
down_read(&xs_state.suspend_mutex);
id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (IS_ERR(id_str)) {
up_read(&xs_state.suspend_mutex);
- return (xenbus_transaction_t )id_str;
+ return PTR_ERR(id_str);
}
- id = simple_strtoul(id_str, NULL, 0);
+ *t = simple_strtoul(id_str, NULL, 0);
kfree(id_str);
-
- return (xenbus_transaction_t) id;
+ return 0;
}
EXPORT_SYMBOL(xenbus_transaction_start);
#include <asm-xen/xen-public/io/xenbus.h>
#include <asm-xen/xen-public/io/xs_wire.h>
-#define XBT_NULL NULL
+#define XBT_NULL 0
/* Register callback to watch this node. */
struct xenbus_watch
int xenbus_register_backend(struct xenbus_driver *drv);
void xenbus_unregister_driver(struct xenbus_driver *drv);
-struct xenbus_transaction;
-typedef struct xenbus_transaction *xenbus_transaction_t;
+typedef u32 xenbus_transaction_t;
char **xenbus_directory(xenbus_transaction_t t,
const char *dir, const char *node, unsigned int *num);
int xenbus_exists(xenbus_transaction_t t,
const char *dir, const char *node);
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
-xenbus_transaction_t xenbus_transaction_start(void);
+int xenbus_transaction_start(xenbus_transaction_t *t);
int xenbus_transaction_end(xenbus_transaction_t t, int abort);
/* Single read and scanf: returns -errno or num scanned if > 0. */
if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
return NULL;
- th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+ th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
result = xs_write(xh, th, path, data, data_n);
if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
return NULL;
- th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+ th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
perms = xs_get_permissions(xh, th, path, &perms_n);
if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
goto exit;
- th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+ th = strtoul(thstr, NULL, 16);
if (!PyList_Check(perms)) {
PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
th = xs_transaction_start(xh);
Py_END_ALLOW_THREADS
- if (th == NULL) {
+ if (th == XBT_NULL) {
PyErr_SetFromErrno(PyExc_RuntimeError);
return NULL;
}
&thstr, &abort))
return NULL;
- th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+ th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
result = xs_transaction_end(xh, th, abort);
if (!PyArg_ParseTuple(args, "ss", &thstr, path))
return 0;
- *th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+ *th = strtoul(thstr, NULL, 16);
return 1;
}
snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
- name = xs_read(handle->xshandle, NULL, path, NULL);
+ name = xs_read(handle->xshandle, XBT_NULL, path, NULL);
if (name == NULL)
name = strdup(" ");
again:
xth = xs_transaction_start(xsh);
- if (xth == NULL)
+ if (xth == XBT_NULL)
errx(1, "couldn't start transaction");
ret = perform(optind, argc, argv, xsh, xth, prefix, tidy);
unsigned int i;
struct sigaction ignorepipe, oldact;
- msg.tx_id = (uint32_t)(unsigned long)t;
+ msg.tx_id = t;
msg.req_id = 0;
msg.type = type;
msg.len = 0;
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
* You can only have one transaction at any time.
- * Returns NULL on failure.
+ * Returns XBT_NULL on failure.
*/
xs_transaction_t xs_transaction_start(struct xs_handle *h)
{
char *id_str;
- unsigned long id;
+ xs_transaction_t id;
id_str = xs_single(h, XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (id_str == NULL)
- return NULL;
+ return XBT_NULL;
id = strtoul(id_str, NULL, 0);
free(id_str);
- return (xs_transaction_t)id;
+ return id;
}
/* End a transaction.
#include <xs_lib.h>
-#define XBT_NULL NULL
+#define XBT_NULL 0
struct xs_handle;
-struct xs_transaction_t;
-typedef struct xs_transaction_t * xs_transaction_t;
+typedef uint32_t xs_transaction_t;
/* On failure, these routines set errno. */